<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>10s倒计时</title>
<style>
	body{
		width:100%;
		height:100%;
		box-sizing: border-box;
	}

	#numDiv{
		position: absolute;
		top: 50%;
		left: 50%;
		margin-left: -100px;
		margin-top: -100px;
		width: 200px;
		height: 200px;
		border: 1px solid #465468;
		text-align: center;
		line-height: 200px;
	}
</style>
<body>
	<div id='numDiv'>10</div>
<script type="text/javascript">
    var num= 10;
    var interval=setInterval(function(){
        if(num == 0){
            clearInterval(interval);
        }
        numDiv.innerHTML = num--;
    },1000);
</script>
</body>
